using System;
using UnityEngine;

[Serializable]
public struct SaveFloat
{
	[SerializeField]
	[HideInInspector]
	private float offset;

	[HideInInspector]
	[SerializeField]
	private float value;

	public SaveFloat(float v = 0f)
	{
		value = (offset = 0f);
		SetValue(v);
	}

	public float GetValue()
	{
		return value - offset;
	}

	public void SetValue(float v)
	{
		offset = UnityEngine.Random.Range(-1000f, 1000f);
		value = v + offset;
	}

	public override string ToString()
	{
		return GetValue().ToString();
	}

	public static implicit operator float(SaveFloat value)
	{
		return value.GetValue();
	}

	public static implicit operator SaveFloat(float value)
	{
		return new SaveFloat(value);
	}
}
